home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: AOCEEncList.h Contains: provides retrtieval and parsing of 'elst' blocks. Necessary for preserving enclosure hierarchy and folders. n.b. MSAMGetEnclosure does not return folders or any hierarchy info, thus this class Written by: David Akhond Copyright: © 1994 by Apple Computer, Inc., all rights reserved. Change History (most recent first): <2> 3/16/95 HDA do it right this time To Do: */ #ifndef __OCE__ #include "OCE.h" #endif #ifndef __OCEMESSAGING__ #include "OCEMessaging.h" #endif #ifndef __OCEMAIL__ #include "OCEMail.h" #endif #ifndef __MEMORY__ #include "Memory.h" #endif #ifndef __TAOCEEnclosure__ #include "AOCEEnclosure.h" #endif #ifndef _EncloseFileList_ #include "EnclosFile.h" #endif #ifndef __FileUtils__ #include "FileUtils.h" #endif //•••••••••••••••••••• #define kMailBuffSize 1024 //•••••••••••••••••••••• typedef struct{ unsigned short fileCount; unsigned short folderCount; }EnclCount; typedef struct{ unsigned short parentsBlockIndex; unsigned short parentsContainerIndex; }ParentIndex; typedef struct{ unsigned short selfBlockIndex; unsigned short selfContainerIndex; // index in the current Block, not globally unsigned long selfOffsetInBlock; }SelfIndex; typedef struct{ char containerName[32]; // name of the container (file or folder) unsigned short asglIndex; // this is index is used by 'edsk' processing. it tells the index of the 'asgl' segment the AppleSingle form of the file is stored in unsigned short attribs; // attributes union{ FInfo fileInfo; DInfo dirInfo; } fndrInfo; unsigned long dataLen, rsrcLen, crDate, modDate, bkDate; union{ FXInfo fileXInfo; DXInfo dirXInfo; } fndrXInfo; unsigned long clmpSize; // who knows what this does? Boolean contentEnclosure; // true if this is a mainContentEnclosure, otherwise false Boolean padByte; // this is whatever garbage happened to be in memory at the time. NOT ZEROED OUT, don't assume it is! } ElstDescriptor; typedef struct{ SelfIndex selfInfo; ParentIndex contextInfo; short vRefNum; long dirID; ElstDescriptor containerDescriptor; } ElstContainer; //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• #ifndef __TAOCEEncList__ #define __TAOCEEncList__ //------------------------------------------------- // TAOCEEncList //------------------------------------------------- class TAOCEEncList { public: TAOCEEncList(); ~TAOCEEncList(); void IAOCEEncList(MailMsgRef myMsgRef, TAOCEEnclosure *theAEnclos); void CountEListBlocks(); void GetEListBuffer(); char ElstByte(); short ElstShort(); void NextContainer(); void AllContainers(); unsigned short FolderCount() {return fFolderCount;}; unsigned short FileCount() {return fFileCount;}; Boolean ContainerIsFolder(ElstContainer* theContainer); Boolean ContainerIsFile(ElstContainer* theContainer); void CreateDirectoryStructure(CFolder *theFolder); void GetContainerParent(ElstContainer *theContainer, short *vRefNum, long *parDirID); void WriteFiles(); void WriteEnclosureFile(ElstContainer *eListContainer, short *vRefNUm, long *parDirID); private: MailMsgRef fMsgRef; TAOCEEnclosure* fTheAEnclos; ElstContainer fPrimaryEList[50]; // this is done out of sheer laziness. AOCEEnclosure segment is a pig anyway, so why not another 5K? long fDirID[50]; // initialized to 0, these are set when a directory is written to disk as the destination for enclosures. // Maps 1 to 1 with the fPrimaryEList. unsigned short fCurrEListBlockIndex; // index of block unsigned short fCurrContainerIndex; // index in the current block unsigned short fGlobalContainerIndex; // index in all blocks (the segment), used as the fPrimaryEList array's index, ordinal Ptr fGetBuffer; // where MSAMGetBlock returns its data long fBuffDataSize; long fBuffDataOffset; // where we are in the current buffer unsigned long fBlockDataOffset; // where we are in the current block unsigned long fNextBlockDataOffset; // where the next data block starts Boolean fEndOfBlock; Boolean fEncListPrepped; unsigned short fEListBlocksCount; short fEnclosuresCount; short fFileCount; short fFolderCount; short fCurrBlocksParentBlockIndex; short fCurrBlocksParentContainerIndex; OSErr fGetBuffErr; CFolder* fRootFolder; CEnclosFileSummary* fReturnSummary; }; #endif __TAOCEEncList__